<?php
require_once ('../../src/db/connectdatabase.php');
require_once ("../dao/AlbumDAO.php");
require_once('../../src/control/RedirectForward.php');

$url = "admin/admin.php?c=album&p=albums&mess=";
$mess = 'error';
if(isset($_POST['act'])) {
	$action = $_POST['act'];
	if($action == 'clock') {// khoa khong cho phep hien thi hang loat
		if(isset($_POST['idcheckmanager'])) {
			$ids = $_POST['idcheckmanager'];
			if(displayAlbumList($ids, '0')) {
				$mess = 'success';
			}
		}
	} else if($action == 'unclock') {// khoa khong cho phep hien thi hang loat
		if(isset($_POST['idcheckmanager'])) {
			$ids = $_POST['idcheckmanager'];
			if(displayAlbumList($ids, '1')) {
				$mess = 'success';
			}
		}
	} else if($action == 'del') {// khoa khong cho phep hien thi hang loat
		if(isset($_POST['idcheckmanager'])) {
			$ids = $_POST['idcheckmanager'];
			if(deleteAlbumDetailByListIDAlbum($ids)) {
				if(deleteListAlbum($ids)) {
					$mess = 'success';
				}
			}
		}
	}
}

redirect($url.$mess);
?>